
// Copyright (C) 2015  Frode Roxrud Gill
// See LICENSE file for license

#include "font.h"

#include "xmega/utils/progmem.h"


static PROGMEM_DECLARE(U8, g_DavidDeviceFont9_alphabet_p[]) = " !\"#$%&'()+,-./0123456789:;<=>?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]_abcdefghijklmnopqrstuvwxyz{}";

static PROGMEM_DECLARE(U8, g_DavidDeviceFont9_font_p[]) = {
CHAR_SIZE(3,0,0), //[SPACE]

CHAR_SIZE(1,6,1), //!
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b00000000,
0b10000000,

CHAR_SIZE(3,2,1), //"
0b10100000,
0b10100000,

CHAR_SIZE(5,7,0), //#
0b01010000,
0b01010000,
0b11111000,
0b01010000,
0b11111000,
0b01010000,
0b01010000,

CHAR_SIZE(3,8,0), //$
0b01000000,
0b01100000,
0b10000000,
0b01000000,
0b00100000,
0b00100000,
0b11000000,
0b01000000,

CHAR_SIZE(3,6,1), //%
0b10100000,
0b00100000,
0b01000000,
0b01000000,
0b10000000,
0b10100000,

CHAR_SIZE(4,6,1), //&
0b01000000,
0b10100000,
0b01000000,
0b11010000,
0b10100000,
0b11110000,

CHAR_SIZE(1,2,1), //'
0b10000000,
0b10000000,

CHAR_SIZE(2,8,0), //(
0b01000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b01000000,

CHAR_SIZE(2,8,0), //)
0b10000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b10000000,

CHAR_SIZE(3,3,3), //+
0b01000000,
0b11100000,
0b01000000,

CHAR_SIZE(2,2,6), //,
0b01000000,
0b10000000,

CHAR_SIZE(2,1,4), //-
0b11000000,

CHAR_SIZE(1,1,6), //.
0b10000000,

CHAR_SIZE(3,6,1), // /
0b00100000,
0b00100000,
0b01000000,
0b01000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,1), //0
0b01000000,
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(1,6,1), //1
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,1), //2
0b11000000,
0b00100000,
0b01000000,
0b10000000,
0b10000000,
0b11100000,

CHAR_SIZE(3,6,1), //3
0b11000000,
0b00100000,
0b01000000,
0b00100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,6,1), //4
0b00100000,
0b10100000,
0b10100000,
0b11100000,
0b00100000,
0b00100000,

CHAR_SIZE(3,6,1), //5
0b11100000,
0b10000000,
0b11000000,
0b00100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,6,1), //6
0b01100000,
0b10000000,
0b11000000,
0b10100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,6,1), //7
0b11100000,
0b00100000,
0b00100000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,6,1), //8
0b11100000,
0b10100000,
0b01000000,
0b10100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,6,1), //9
0b11100000,
0b10100000,
0b10100000,
0b01100000,
0b00100000,
0b11000000,

CHAR_SIZE(1,4,3), //:
0b10000000,
0b00000000,
0b00000000,
0b10000000,

CHAR_SIZE(2,5,3), //;
0b01000000,
0b00000000,
0b00000000,
0b01000000,
0b10000000,

CHAR_SIZE(4,3,4), //<
0b00110000,
0b11000000,
0b00110000,

CHAR_SIZE(2,3,3), //=
0b11000000,
0b00000000,
0b11000000,

CHAR_SIZE(4,3,4), //>
0b11000000,
0b00110000,
0b11000000,

CHAR_SIZE(3,6,1), //?
0b01000000,
0b10100000,
0b00100000,
0b01000000,
0b00000000,
0b01000000,

CHAR_SIZE(3,6,1), //A
0b01000000,
0b10100000,
0b10100000,
0b11100000,
0b10100000,
0b10100000,

CHAR_SIZE(3,6,1), //B
0b11000000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,6,1), //C
0b01000000,
0b10100000,
0b10000000,
0b10000000,
0b10100000,
0b01000000,

CHAR_SIZE(3,6,1), //D
0b11000000,
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b11000000,

CHAR_SIZE(2,6,1), //E
0b11000000,
0b10000000,
0b11000000,
0b10000000,
0b10000000,
0b11000000,

CHAR_SIZE(2,6,1), //F
0b11000000,
0b10000000,
0b11000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,1), //G
0b01000000,
0b10100000,
0b10000000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,6,1), //H
0b10100000,
0b10100000,
0b11100000,
0b10100000,
0b10100000,
0b10100000,

CHAR_SIZE(1,6,1), //I
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,1), //J
0b00100000,
0b00100000,
0b00100000,
0b00100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,6,1), //K
0b10100000,
0b10100000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,

CHAR_SIZE(3,6,1), //L
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b11100000,

CHAR_SIZE(5,6,1), //M
0b10001000,
0b11011000,
0b11011000,
0b10101000,
0b10001000,
0b10001000,

CHAR_SIZE(4,6,1), //N
0b10010000,
0b10010000,
0b11010000,
0b10110000,
0b10010000,
0b10010000,

CHAR_SIZE(3,6,1), //O
0b01000000,
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,6,1), //P
0b11000000,
0b10100000,
0b10100000,
0b11000000,
0b10000000,
0b10000000,

CHAR_SIZE(4,7,1), //Q
0b01000000,
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01100000,
0b00010000,

CHAR_SIZE(3,6,1), //R
0b11000000,
0b10100000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,

CHAR_SIZE(3,6,1), //S
0b01100000,
0b10000000,
0b01000000,
0b00100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,6,1), //T
0b11100000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,6,1), //U
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,6,1), //V
0b10100000,
0b10100000,
0b10100000,
0b10100000,
0b01000000,
0b01000000,

CHAR_SIZE(5,6,1), //W
0b10001000,
0b10001000,
0b10101000,
0b10101000,
0b01010000,
0b01010000,

CHAR_SIZE(3,6,1), //X
0b10100000,
0b10100000,
0b01000000,
0b01000000,
0b10100000,
0b10100000,

CHAR_SIZE(3,6,1), //Y
0b10100000,
0b10100000,
0b10100000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,6,1), //Z
0b11100000,
0b00100000,
0b01000000,
0b01000000,
0b10000000,
0b11100000,

CHAR_SIZE(2,8,0), //[
0b11000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b11000000,

CHAR_SIZE(2,8,0), //]
0b11000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b11000000,

CHAR_SIZE(4,1,7), //_
0b11110000,

CHAR_SIZE(3,4,3), //a
0b11000000,
0b01100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,6,1), //b
0b10000000,
0b10000000,
0b11000000,
0b10100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,4,3), //c
0b01100000,
0b10000000,
0b10000000,
0b01100000,

CHAR_SIZE(3,6,1), //d
0b00100000,
0b00100000,
0b01100000,
0b10100000,
0b10100000,
0b11100000,

CHAR_SIZE(3,4,3), //e
0b01000000,
0b10100000,
0b11000000,
0b01100000,

CHAR_SIZE(2,6,1), //f
0b01000000,
0b10000000,
0b11000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,3), //g
0b01000000,
0b10100000,
0b10100000,
0b01100000,
0b00100000,
0b11000000,

CHAR_SIZE(3,6,1), //h
0b10000000,
0b10000000,
0b11000000,
0b10100000,
0b10100000,
0b10100000,

CHAR_SIZE(1,6,1), //i
0b10000000,
0b00000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(2,8,1), //j
0b01000000,
0b00000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b01000000,
0b10000000,

CHAR_SIZE(3,6,1), //k
0b10000000,
0b10000000,
0b10100000,
0b11000000,
0b10100000,
0b10100000,

CHAR_SIZE(1,6,1), //l
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(5,4,3), //m
0b11010000,
0b10101000,
0b10101000,
0b10101000,

CHAR_SIZE(3,4,3), //n
0b11000000,
0b10100000,
0b10100000,
0b10100000,

CHAR_SIZE(3,4,3), //o
0b01000000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(3,6,3), //p
0b11000000,
0b10100000,
0b10100000,
0b11000000,
0b10000000,
0b10000000,

CHAR_SIZE(3,6,3), //q
0b01000000,
0b10100000,
0b10100000,
0b01100000,
0b00100000,
0b00100000,

CHAR_SIZE(2,4,3), //r
0b11000000,
0b10000000,
0b10000000,
0b10000000,

CHAR_SIZE(2,4,3), //s
0b11000000,
0b10000000,
0b01000000,
0b11000000,

CHAR_SIZE(3,6,1), //t
0b01000000,
0b01000000,
0b11100000,
0b01000000,
0b01000000,
0b01000000,

CHAR_SIZE(3,4,3), //u
0b10100000,
0b10100000,
0b10100000,
0b01100000,

CHAR_SIZE(3,4,3), //v
0b10100000,
0b10100000,
0b10100000,
0b01000000,

CHAR_SIZE(5,4,3), //w
0b10001000,
0b10101000,
0b10101000,
0b01010000,

CHAR_SIZE(3,4,3), //x
0b10100000,
0b01000000,
0b01000000,
0b10100000,

CHAR_SIZE(3,6,3), //y
0b10100000,
0b10100000,
0b10100000,
0b01000000,
0b01000000,
0b10000000,

CHAR_SIZE(2,4,3), //z
0b11000000,
0b01000000,
0b10000000,
0b11000000,

CHAR_SIZE(3,8,0), //{
0b00100000,
0b01000000,
0b01000000,
0b01000000,
0b10000000,
0b01000000,
0b01000000,
0b00100000,

CHAR_SIZE(3,8,0), //}
0b10000000,
0b01000000,
0b01000000,
0b01000000,
0b00100000,
0b01000000,
0b01000000,
0b10000000
};

DavidDeviceFont9::DavidDeviceFont9()
: Font(8, 1, &g_DavidDeviceFont9_alphabet_p[0], &g_DavidDeviceFont9_font_p[0])
{
}

DavidDeviceFont9::~DavidDeviceFont9()
{
}

U8 DavidDeviceFont9::GetAlphabetByte(U8 pos) const
{
	return pgm_read_byte(&g_DavidDeviceFont9_font_p[pos]);
}

U8 DavidDeviceFont9::GetFontdataByte(U16 ch_offset, U8 pos) const
{
	return pgm_read_byte(&g_DavidDeviceFont9_font_p[ch_offset+pos]);
}
